{% macro pagination(url, pageNum, pageSize, count) %}

<div class="pagination">
  <a href="{{url}}?pageNum=1&pageSize={{pageSize}}">首页</a>

  {% if pageNum > 1 %}
  <!-- 不是第一页时，显示上一页 -->
  <a href="{{url}}?pageNum={{pageNum-1}}&pageSize={{pageSize}}">&lt;</a>
  {% endif %}

  {% for i in range(0,count/pageSize)%}
  <!-- 循环遍历页码 -->
  <a href="{{url}}?pageNum={{i+1}}&pageSize={{pageSize}}" class="current">{{i+1}}</a>
  {% endfor %}

  <!-- 不是最后一页时，显示下一页 -->
  {% if pageNum <= count /pageSize %} <a href="{{url}}?pageNum={{pageNum+1}}&pageSize={{pageSize}}">
    &gt;
    </a>
    {% endif %}
    <!-- 尾页 -->
    <a href="{{url}}?pageNum={{(count/pageSize)|round(0,'ceil')}}&pageSize={{pageSize}}">尾页</a>
</div>

{% endmacro %}
